/**
 * 通用对象定义
 */
if(typeof onion == 'undefined')
	onion = new Object();

/**
 * 注册命名空间
 * 
 * 例如onion.register("onion.jsf")，之后则可以写：
 * onion.jsf.abc = "";
 */
onion.register = function(namespace){
	if(typeof namespace != 'string' || namespace == "" || namespace == "onion")
		throw "参数错误";
	
	var names = namespace.split(".");
	
	var temp,start = 0;
	
	if(names[0] == "onion"){
		temp = onion;
		start = 1;
	}
	else
		temp = window;
	
	for(var i=start;i<names.length;i++){
		if(temp[names[i]] == null)
			temp[names[i]] = new Object();
		temp = temp[names[i]];
	}
	
	return temp;
};